package cn.edu.ctbu.demo1.service;

import cn.edu.ctbu.demo1.domain.Student;
import cn.edu.ctbu.demo1.repository.StudentRepository;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.domain.Example;
import org.springframework.data.domain.ExampleMatcher;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.Pageable;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public interface StudentService {



    List<Student> findAll();
    /**
     * 分页
     * @param pageable
     * @return
     */
    Page<Student> findAll(Pageable pageable);
    /**
     * 动态
     * @param studentExample
     * @return
     */
    List<Student>findAll(Example<Student>studentExample);
    /**
     * 支持分页与动态查询与姓名首字匹配
     * @param student
     * @param pageable
     * @return
     */
    Page<Student> findAll(Student student,Pageable pageable);

    /**
     * 分页，带过滤的查询
     * @param studentExample
     * @param pageable
     * @return
     */
    Page<Student> findAll(Example<Student>studentExample,Pageable pageable);
    /**
     * 按id进行查询
     * @param id 主键 整数
     * @return
     */
    Student getById(Integer id);
    /**
     * 按名字进行查询，like
     * @param name
     * @return
     */
    List<Student> findByNameLike(String name);
    /**
     * 按姓名和班级名称一起查询
     * @param name
     * @param classname
     * @return
     */
//    List<Student> findByNameLikeAndClassname(String name, String classname);
    Student findByNameLikeAndClassname(String name, String classname) throws Exception;
    List<Student> findByNameLikeAndPassword(String name, String password);
    void Insert(Student student);
    void update(Student student);

    void delete(Integer id);


}
